Skip to content

Conversation

@shahargl
Copy link
Member

close #5047

The core issue #5047 involved CEL filters failing to return alerts with dismissed: false after their dismissedUntil period expired. This occurred because SQL-based CEL filtering directly queried raw database values, bypassing the AlertDto validation that correctly handles dismissal expiration.

The fix introduced a cleanup_expired_dismissals() function in keep/api/core/db.py. This function updates the database, setting dismissed=false for alerts where dismissedUntil has passed. This ensures SQL queries reflect the correct dismissal status. The cleanup is now exclusively called within query_last_alerts() in keep/api/core/alerts.py. A previous duplicate call in keep/searchengine/searchengine.py was removed to ensure cleanup occurs only once at the lowest query level, preventing redundant operations.

Comprehensive testing was added in tests/test_expired_dismissal_cel_fix_enhanced.py using freezegun to simulate time progression, verifying the fix across various expiration scenarios, API integration, and edge cases. The test_fix_demo.py script was also updated for standalone verification.

Redundant code from an initial misunderstanding was removed:

  • RSS-related functions (_generate_rss_feed, get_preset_rss_feed) and an unused escape import were removed from keep/api/routes/preset.py.
  • The tests/test_rss_feed.py file was deleted.
  • Documentation files (EXPIRED_DISMISSAL_FIX_SUMMARY.md, FINAL_COMPLETION_SUMMARY.md) and test_fix_demo.py were moved to the tests/ directory for better organization.

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jun 17, 2025
@vercel
Copy link

vercel bot commented Jun 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
keep ⬜️ Ignored (Inspect) Visit Preview Jun 17, 2025 3:47pm

@dosubot dosubot bot added API API related issues Bug Something isn't working labels Jun 17, 2025
cursor[bot]

This comment was marked as outdated.

@cursor
Copy link

cursor bot commented Jun 17, 2025

🚨 BugBot couldn't run

Bugbot requires usage-based pricing.

Have a team administrator enable usage-based pricing in your Cursor dashboard to continue using BugBot.

@codecov
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 41.66667% with 28 lines in your changes missing coverage. Please review.

Project coverage is 46.24%. Comparing base (e69b703) to head (15baedf).
Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
keep/api/core/db.py 38.09% 26 Missing ⚠️
keep/api/core/alerts.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5050      +/-   ##
==========================================
+ Coverage   46.21%   46.24%   +0.03%     
==========================================
  Files         172      173       +1     
  Lines       17833    17901      +68     
==========================================
+ Hits         8241     8279      +38     
- Misses       9592     9622      +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shahargl shahargl closed this Jun 19, 2025
@shahargl shahargl reopened this Jun 19, 2025
@shahargl shahargl closed this Jun 19, 2025
@cursor
Copy link

cursor bot commented Jun 19, 2025

🚨 BugBot couldn't run

Something went wrong. Try again by commenting "bugbot run", or contact support (requestId: serverGenReqId_70472267-dc01-4f78-867f-5d45b4beecaf).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API API related issues Bug Something isn't working size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: CEL filters not returning alerts with dismissed: false after dismissedUntil expires

2 participants